package M;

import rx.Notification;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action1;

public class m {

    public static void main(String[] args) {

    }

    public static void materialize() {

        Observable
                .create(new Observable.OnSubscribe<Integer>() {
                    public void call(Subscriber<? super Integer> subscriber) {
                        for (int i = 0; i < 2; i++) {
                            subscriber.onNext(i);
                        }
                        subscriber.onCompleted();
                    }
                })
                .materialize()
                .subscribe(new Action1<Notification<Integer>>() {
                    public void call(Notification<Integer> notification) {
                        System.out.println(notification.getValue());
                    }
                });
    }
}
